package main.java.net;

import java.io.IOException;

/*
    网络端的服务器对象
 */
/* 服务端 */
public class NetServer {
    public static void main(String[] args) throws IOException {
        //构建ServerSocket对象，监听6666端口
        java.net.ServerSocket serverSocket = new java.net.ServerSocket(6666);
        System.out.println("服务器已启动，等待客户端连接...");
        //通过accept方法获取客户端Socket对象
        java.net.Socket socket = serverSocket.accept();
        //输出客户端信息
        System.out.println("客户端链接了,Client:"+socket);
    }
}
